﻿using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace YY.Admin.Core.Converter
{
    public class EnumToTagTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is StatusEnum status)
            {
                return status switch
                {
                    StatusEnum.Enable => Application.Current.FindResource("SuccessBrush"),   // 启用 - 绿色
                    StatusEnum.Disable => Application.Current.FindResource("DangerBrush"),   // 禁用 - 红色
                    _ => Application.Current.FindResource("InfoBrush")
                };
            }

            return Application.Current.FindResource("InfoBrush");
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
